import request from '@/config/axios'

// 产品类别 VO
export interface ProductTypeVO {
  id: number // 主键id
  parentId: number // 父产品id
  name: string // 类别名称
}

// 产品类别 API
export const ProductTypeApi = {
  // 查询产品类别列表
  getProductTypeList: async (params) => {
    return await request.get({ url: `/studio/product-type/list`, params })
  },

  // 查询产品类别详情
  getProductType: async (id: number) => {
    return await request.get({ url: `/studio/product-type/get?id=` + id })
  },

  // 新增产品类别
  createProductType: async (data: ProductTypeVO) => {
    return await request.post({ url: `/studio/product-type/create`, data })
  },

  // 修改产品类别
  updateProductType: async (data: ProductTypeVO) => {
    return await request.put({ url: `/studio/product-type/update`, data })
  },

  // 删除产品类别
  deleteProductType: async (id: number) => {
    return await request.delete({ url: `/studio/product-type/delete?id=` + id })
  },

  // 导出产品类别 Excel
  exportProductType: async (params) => {
    return await request.download({ url: `/studio/product-type/export-excel`, params })
  },
}